package org.bbelovic.devel.metro.wsdlfirst.sts;

import com.sun.xml.wss.impl.callback.PasswordValidationCallback;
import com.sun.xml.wss.impl.callback.PasswordValidationCallback.PasswordValidationException;
import com.sun.xml.wss.impl.callback.PasswordValidationCallback.PasswordValidator;
import com.sun.xml.wss.impl.callback.PasswordValidationCallback.Request;

public class PlainTextPasswordValidator implements PasswordValidator {

    @Override
    public boolean validate(Request request) throws PasswordValidationException {
        final PasswordValidationCallback.PlainTextPasswordRequest plainTextRequest = (PasswordValidationCallback.PlainTextPasswordRequest)request;
        if ("bbelovic".equals(plainTextRequest.getUsername()) && "mypasswd".equals(plainTextRequest.getPassword())) {
            return true;
        }
        return false;
    }

}